package cn.bdqn.service.sys.impl;

import cn.bdqn.dao.sys.SysRoleDao;
import cn.bdqn.entity.SysRole;
import cn.bdqn.service.sys.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ProjectName: ycbdqn
 * @Package: cn.bdqn.service.sys.impl
 * @Author: huat
 * @Date: 2020/3/8 16:41
 * @Version: 1.0
 */
@Service
public class SysRoleServiceImpl implements SysRoleService {
    @Autowired
    SysRoleDao sysRoleDao;
    /**
     * 获取所有角色信息
     * @return
     */
    @Override
    public List<SysRole> getAllRole() {
        return sysRoleDao.getAllRole();
    }
    /**
     * 查询用户角色id和所有角色
     * @param id 用户id
     * @return
     */
    @Override
    public Map<String,Object> getUserRoleId(int id) {
        Map<String,Object> map=new HashMap<String,Object>();
        map.put("userRoleId",sysRoleDao.getUserRoleId(id));
        map.put("role",sysRoleDao.getAllRole());
        return map;
    }
}
